# player
(include "playerClass.dd")
(include "pickup.dd")

# main class
( class world_main World (group

	# stage's paddings
	# useful to control everything that moves inside it
	# also to make sure the game works the same
	# way on different screen sizes, by keeping the
	# samem aspect ratio
	(def int paddingHorizontal)
	(def int paddingVertical  )

	# player
	(def playerClass player)

	# pickups
	(def Pickup pickup)

	# clicking the screen moves to next target
	(function input (group) (this.player.slowDown))

	# start
	(function start (group) (group

		(= this.paddingHorizontal 10)
		(= this.paddingVertical   10)

		# init player
		(= this.player (new playerClass))
		(this.player.init)

		# init pickup
		(= this.pickup (new Pickup))
		(= this.pickup.limitX this.paddingHorizontal)
		(= this.pickup.limitY this.paddingVertical)
		(this.pickup.init)
		(= this.pickup.player this.player.sprite)
	))

	# update
	(function update (group) (group
		(this.player.update)
		(this.pickup.update)

		(if (>= this.player.sprite.x this.pickup.sprite.x)
			(echo "player is right")
		)
	))

	(function resize (group) (group
	))

	# assets
	(function assets(group) (group
		(return (array "images/dd_logo.png"))
	))

))
